<template>
	<view class="authorityManagemant">
		<u-navbar title=""  :border-bottom="false"  >
			<view class="navbar__search" @click="toSearch">
					<u-icon name="search" color="#000000" :size="28"></u-icon>
					<view   class="navbar__search__text">
						搜索用户
					</view>
			</view>
			<view class="navbar__submit" :slot="right" >搜索</view>
		</u-navbar>
		
		<view class="authorityManagemant__authorityData">
			<view class="authorityManagemant__authorityData__list" v-for="(authority,index) in authorityData">
				<view class="authorityManagemant__authorityData__list__title">
					{{authority.role}}
				</view>

				<view class="authorityManagemant__authorityData__list__staff"  v-for="(staff,index) in authority.list">
					<view class="authorityManagemant__authorityData__list__staff__pic">
						<u-avatar :src="staff.pic" size="100" style="margin-right: 10px;"></u-avatar>
					</view>
					<view class="authorityManagemant__authorityData__list__staff__text">
						<view class="authorityManagemant__authorityData__list__staff__text__username">{{staff.realname}}</view>
						<view class="authorityManagemant__authorityData__list__staff__text__description">{{staff.description}}</view>
					</view>

					<view class="authorityManagemant__authorityData__list__staff__set">
						<view class="authorityManagemant__authorityData__list__staff__set__edit" @click="staff.setModalshow=true">
							设置
						</view>
						<u-icon @click="staff.deleteModalShow=true" name="trash" size="30" class="authorityManagemant__authorityData__list__staff__set__delete"></u-icon>
					</view>
				
					<u-modal v-model="staff.deleteModalShow" title="" >
						"确认删除员工{{staff.realname}}？"
					</u-modal>
					
					<u-modal v-model="staff.setModalshow" :title="'设置员工'+staff.realname+'权限'" :mask-close-able="true">
						<u-radio-group  class="authorityManagemant__authorityData__list__staff__set__modal" v-model="staff.authority">
							<u-radio 
								class="authorityManagemant__authorityData__list__staff__set__modal__item"
								v-for="(item, index) in authorList" :key="index" 
								:name="item.name"
							>
								{{item.name}}
							</u-radio>
						</u-radio-group>
					</u-modal>
					
					

					
				</view>
			</view>
		</view>
	</view>

</template>

<script>
	import authorityData from "./authorityData.js"
	export default {
		data() {
			return {
				authorityData:authorityData.authorityList,
				authorList:[
					{
						name:"员工管理员",
					},{
						name:"公司一级管理员",
					},{
						name:"公司二级管理员",
					},{
						name:"普通员工",
					},{
						name:"普通用户",
					}
				]
			}
		},
		methods: {
			goback(){
				uni.navigateBack()
			},
			toSearch(){
				uni.navigateTo({
					url:"/pages/core/mine/authorityManagement/userSearch"
				})
			}
		}
	}
</script>

<style lang="less">
.navbar {
	&__search{
		border-radius: 100rpx;
		display: flex;
		align-items: center;
		padding: 0 @uni-spacing-col-lg;
		width: 75%;
		background-color: @uni-bg-color-grey;
		&__text{
			color:#3F536E;
			margin-left: @uni-spacing-row-lg;
			padding: @uni-spacing-row-base 0;
		}
	}
	&__submit{
		margin-right: auto;
		margin-left: auto;
	}
}
.authorityManagemant{

	&__authorityData{
		padding-top: 10px;
		&__list{
			padding: 0rpx 30rpx 30rpx 30rpx;
			&__title{
				margin-bottom: 10rpx;
				font-weight: bold;
			}
			&__staff{
				display: flex;
				align-items: center;
				padding-bottom: 10px;
				margin-bottom: 10rpx;
				border-bottom: 0.5px solid #e2e2e2;
					
				&__pic{
					
				}
				&__text{
					display: flex;
					flex-direction: column;
					
					&__username {
						margin-bottom: 10px;
						font-size: small;
						font-weight: bold;
					}
				
					&__description {
						word-break: break-all;
						text-overflow: ellipsis;
						display: -webkit-box;
						/** 对象作为伸缩盒子模型显示 **/
						-webkit-box-orient: vertical;
						/** 设置或检索伸缩盒对象的子元素的排列方式 **/
						-webkit-line-clamp: 1;
						/** 显示的行数 **/
						overflow: hidden;
						/** 隐藏超出的内容 **/
						font-size: small;
						color: #5e6671;
					}
				
				}
				&__set{
					margin-left: auto ;
					
					display: flex;
					flex-direction: row;
					&__edit{
						margin-right: 10rpx;
						padding: 15rpx 20rpx;
						border-radius: 15rpx;
						background-color: #f5f5f5;
						color: #007AFF;
						font-size: small;
					}
					&__delete{
						
					}
					&__modal{
						display: flex;
						flex-direction: column;
						margin-top: 10;
						&__item{
							margin:0px auto 10px 30px;
						}
					}
				}
		
			}
		}
	
	
	
	
	}
}
</style>
